#include<iostream>
using namespace std;
template<typename T>
void Swap(T *a,T *b,int n)
{
	T temp;
	for(int i=0;i<n;i++)
	{
		temp = a[i];
		a[i] = b[i];
		b[i] = temp;
	}
}
template<typename T>
void Swap(T &a,T &b)
{
	T temp;
	temp = a;
	a = b;
	b = temp;
}
void print(int *a,int n)
{
	for(int i=0;i<n;i++)
		cout<<a[i]<<" ";
	cout<<endl;
}
int main()
{
	int a=3,b=4;
	int a1[] = {1,2,3};
	int b1[] = {5,6,7};
	cout<<"当前a = "<<a<<" b = "<<b<<" ";
	cout<<"交换后:";
	Swap(a,b);
	cout<<"当前a = "<<a<<" b = "<<b<<endl;

	cout<<"当前数组a1 = ";
	print(a1,3);
	cout<<" b1 ";
	print(b1,3);
	cout<<"交换后:";
	Swap(a1,b1,3);
	cout<<"当前数组 a1 = ";
	print(a1,3);
	cout<<" b1 = ";
	print(b1,3);
}
